*EET Replication Instructions 2019-2022

*Below are instructions for replicating all manuscript and online appendix tables and figures in STATA. The complete dataset is called "EET replication do file_jbee_final.dta". Additional code to create the EET preferences as well as undefined preferences and missing preferences can be found in "EET preferences do file.dta". Those variables are already coded. 

*Note: You may need to install STATA packages for cibar, catcibar  and iebaltab commands. Use findit with command name to identify and download the appropriate packets to install. To install the catcibar command enter the following:
*ssc install cibar
*net install catcibar, from("https://aarondwolf.github.io/catcibar")
*findit iebaltab

*Manuscript Text

*We collected EET data from four nationally representative online surveys involving 6,275 respondents through the survey research firm Dynata between May 24-28, 2019 (N=1210); October 27-November 1, 2020 (N=955); November 10-23, 2022 (N=609); May 19-25, 2021 (N=1501); and May 20-30, 2022 (N=2000).

tab surveyyr 
tab surveyyr wave

*Table 4. Social Preferences Towards Democrat and Republican by Party ID (%, Pooled).

sum Altruistic_Dem- Spiteful_Dem if pid3==1
sum Altruistic_Rep- Spiteful_Rep if pid3==1
sum Altruistic_Dem- Spiteful_Dem if pid3==3
sum Altruistic_Rep- Spiteful_Rep if pid3==3
sum Altruistic_Dem- Spiteful_Dem if pid3==2
sum Altruistic_Rep- Spiteful_Rep if pid3==2

tab missingdem if pid3==1
tab noprefdem if pid3==1
tab nonresponsedem if pid3==1
tab missingrep if pid3==1
tab noprefrep if pid3==1
tab nonresponserep if pid3==1

tab missingdem if pid3==3
tab noprefdem if pid3==3
tab nonresponsedem if pid3==3
tab missingrep if pid3==3
tab noprefrep if pid3==3
tab nonresponserep if pid3==3

tab missingdem if pid3==2
tab noprefdem if pid3==2
tab nonresponsedem if pid3==2
tab missingrep if pid3==2
tab noprefrep if pid3==2
tab nonresponserep if pid3==2

*Figure 1. Fairness and Spite Preferences over Time (marginal effects)

reg Inequality_Averse_Dem i.surveyyr##i.pid3, robust
margins surveyyr, over(pid3)
marginsplot 
graph save g1, replace

reg Inequality_Averse_Rep i.surveyyr##i.pid3, robust
margins surveyyr, over(pid3)
marginsplot
graph save g2, replace

graph combine "g1.gph" "g2.gph"

reg Spiteful_Dem i.surveyyr##ib2.pid3, robust 
margins surveyyr, over(pid3)
marginsplot
graph save g3, replace

reg Spiteful_Rep i.surveyyr##ib2.pid3, robust
margins surveyyr, over(pid3)
marginsplot
graph save g4, replace
graph combine "g3.gph" "g4.gph"

*Note: Additional formatting required

*Appendix Figure 1. EET Preferences by Respondent and Recipient Party ID over Time

catcibar Altruistic_Dem- Spiteful_Dem, by(surveyyr) over(pid3) xlabel(1 "Altruistic" 2 "Envious" 3 "Equality Averse" 4 "Inequality Averse" 5 "Kick Down" 6 "Kiss Up" 7 "MaxiMin" 8 "Selfish" 9 "Spiteful")

catcibar Altruistic_Rep- Spiteful_Rep, by(surveyyr) over(pid3) xlabel(1 "Altruistic" 2 "Envious" 3 "Equality Averse" 4 "Inequality Averse" 5 "Kick Down" 6 "Kiss Up" 7 "MaxiMin" 8 "Selfish" 9 "Spiteful")

*Appendix Replication

*Demographic Characteristics of the Samples

sum surveyyr female age education income hhincome race latino i.ideo i.pid3 region rural evangelical

*Balance Tables

iebaltab female age education income hhincome race latino ideo pid3 region rural evangelical if surveyyr==2019, groupvar(asked_first)  savexlsx(pidbalance19)
iebaltab female age education income hhincome race latino ideo pid3 region rural evangelical if surveyyr==2020, groupvar(pidtxt)  savexlsx(pidbalance20)
iebaltab female age education income hhincome race latino ideo pid3 region rural evangelical if surveyyr==2021, groupvar(pidtxt)  savexlsx(pidbalance21)
iebaltab female age education income hhincome race latino ideo pid3 region rural evangelical if surveyyr==2022, groupvar(asked_first)  savexlsx(pidbalance22)

*Regression Models from Manuscript Figure 1 (OLS Regression)

reg Inequality_Averse_Dem i.surveyyr##i.pid3, robust
reg Inequality_Averse_Rep i.surveyyr##ib2.pid3, robust
reg Spiteful_Dem i.surveyyr##i.pid3, robust 
reg Spiteful_Rep i.surveyyr##ib2.pid3, robust

*Regression Models from Manuscript Figure 1 (OLS Regression, Extended Controls)

reg Inequality_Averse_Dem i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
reg Inequality_Averse_Rep i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
reg Spiteful_Dem i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
reg Spiteful_Rep i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust

*Regression Models from Manuscript Figure 1 (Logit Regression)

logit Inequality_Averse_Dem i.surveyyr##i.pid3, robust
logit Inequality_Averse_Rep i.surveyyr##ib2.pid3, robust
logit Spiteful_Dem i.surveyyr##i.pid3, robust 
logit Spiteful_Rep i.surveyyr##ib2.pid3, robust

*Regression Models from Manuscript Figure 1 (OLS Regression, Extended Controls)

logit Inequality_Averse_Dem i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
logit Inequality_Averse_Rep i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
logit Spiteful_Dem i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
logit Spiteful_Rep i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust

*Analysis of Undefined Preferences and Missing Data

*Undefined Choice Predictors (Logit Regression)

logit noprefdem i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
logit noprefrep i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
logit nonresponsedem i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust
logit nonresponserep i.surveyyr ib3.pid3 female age education hhincome ib2.race latino evangelical rural i.region  , robust

log close
